﻿/***************************************************
 * File name: ShoppingCartViewModel.cs 
 * Author: Team A
 * Change Log: Please see SVN repository: http://test-project-drew1.googlecode.com/svn/trunk/
 * Date: December 2013
 * Description: See <summary> tab below
 * *************************************************/

using System;
using System.Collections.Generic;
using System.Linq;
using System.Security.Principal;
using System.Web;
using WebMatrix.WebData;

namespace WSCeCommerceWeb.Helpers
{

    /// <summary>
    /// Helper class for Security
    /// </summary>
    public class SecurityHelper
    {
        //Known System roles
        public const string ADMIN_ROLE = "AdminRole";
        public const string EMPLOYEE_ROLE = "Employee";

        /// <summary>
        /// Determines if the current user can manage a page. The user must be in AdminRole or Employee Role
        /// </summary>
        /// <returns>true if the current user can manage</returns>
        public static bool AlllowManage()
        {
            IPrincipal user = HttpContext.Current.User;

            return user.IsInRole(ADMIN_ROLE) || user.IsInRole(EMPLOYEE_ROLE);
        }
    }
}